package com.mjl.shops.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mjl.shops.R;
import com.mjl.shops.bean.ConvertBean;
import com.mjl.shops.utils.StringUtils;

import java.util.List;

public class ConvertAdapter extends BaseQuickAdapter<ConvertBean, BaseViewHolder> {

    public ConvertAdapter(int layoutResId, @Nullable List<ConvertBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ConvertBean item) {

        if (StringUtils.strEmpty(item.getActivityName())) {
            helper.setText(R.id.activity_name_tv, item.getActivityName());
        } else {
            helper.setText(R.id.activity_name_tv, "活动名称");
        }

        if (StringUtils.strEmpty(item.getTicketCode())) {
            helper.setText(R.id.convert_code_tv, item.getTicketCode());
        } else {
            helper.setText(R.id.convert_code_tv, "券号");
        }

        if (StringUtils.strEmpty(item.getConverDate())) {
            helper.setText(R.id.conver_date_tv, item.getConverDate());
        } else {
            helper.setText(R.id.conver_date_tv, "兑换日期");
        }

        if (StringUtils.strEmpty(item.getConsigneePerson())) {
            helper.setText(R.id.consignee_person_tv, item.getConsigneePerson());
        } else {
            helper.setText(R.id.consignee_person_tv, "收货人");
        }

        if (StringUtils.strEmpty(item.getConsigneeAddress())) {
            helper.setText(R.id.consignee_address_tv, item.getConsigneeAddress());
        } else {
            helper.setText(R.id.consignee_address_tv, "收货地址");
        }

        if (StringUtils.strEmpty(item.getConsigneeState())) {
            helper.setText(R.id.consignee_state_tv, item.getConsigneeState());
        } else {
            helper.setText(R.id.consignee_state_tv, "发货状态");
        }

        if (StringUtils.strEmpty(item.getExpressCode())) {
            helper.setText(R.id.express_code_tv, item.getExpressCode());
        } else {
            helper.setText(R.id.express_code_tv, "快递单号");
        }

        if (StringUtils.strEmpty(item.getExpressCompany())) {
            helper.setText(R.id.express_company_tv, item.getExpressCompany());
        } else {
            helper.setText(R.id.express_company_tv, "快递公司");
        }
    }
}
